<template>
	<div>
		<!--所属集群 选择-->
		<baseSelect 
			ref="baseSelect"
			:defaultValue="defaultValue" 
			:optionList="options" 
			:filterable="true"
			@change="changeHandel"></baseSelect>
	</div>
</template>

<script>
import baseSelect from "@/view/components/select/select";
import { getClusterList } from "@/service/swagger/ResourceClusterController"

export default {
	components: {
		baseSelect
	},
	props: [
		"defaultValue",
		"id"
	],
	data() {
		return {
			options: [],
			copyDefaultValue: '',
		}
	},
	mounted() {
		this.getData();
	},

	methods : {
			changeHandel(name , v, selectedArr){
				this.$emit("change", "jiqunSelect", v, selectedArr)
			},
		
			getData(){
				getClusterList({
					//groupNames : ["cluster_type"]
				}).then(ret=>{
					this.options = ret.data.data.map(el=>{
							return {
								label : el.clusterName ,
								value : el.id ,
								sourceData : el,
					}
					this.$refs.baseSelect.asyncUpdateOption(this.options)
				})
			})
		},

		reset() {
			this.$refs.baseSelect.reset()
		}
	}
}
</script>

<style>
</style>